﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernateSample.Domain.Entities;
using NHibernate;

namespace NHibernateSample.Data
{
    public class OrderManage
    {
        protected ISession Session { get; set; }
        public OrderManage(ISession session)
        {
            Session = session;
        }

        public OrderManage()
        {
            Session = new NHibernateHelper().GetSession();
        }

        public void SaveOrder(Order order)
        {
            Session.SaveOrUpdate(order);
            Session.Flush();
        }

        public Order GetOrderByID(int orderID)
        {
            return Session.Get<Order>(orderID);
        }
    }
}
